#ifndef RENDERVIEW_H
#define RENDERVIEW_H

#include <GL/glew.h>
#include <QGLWidget>
class QResizeEvent;
class QCloseEvent;
class QMouseEvent;
class RenderViewThread;

class RenderView : public QGLWidget
{
    Q_OBJECT
  public:
    explicit RenderView(QWidget *parent = 0);
    virtual ~RenderView();
    void startRendering(unsigned int frameRateInHz = 60);
    const RenderViewThread * const thread() const;

  signals:
    void fps(unsigned int);

  public slots:
    void OnThreadFps(unsigned int fps);

  // Protected Methods
  protected:
    virtual void resizeEvent(QResizeEvent *e);
    virtual void closeEvent(QCloseEvent *e);
    virtual void mouseMoveEvent(QMouseEvent *e);
    virtual void mouseDoubleClickEvent(QMouseEvent *e);
    virtual void mousePressEvent(QMouseEvent *e);
    virtual void mouseReleaseEvent(QMouseEvent *e);
    virtual void wheelEvent(QWheelEvent *e);
    virtual void keyPressEvent(QKeyEvent *e);
    virtual void keyReleaseEvent(QKeyEvent *e);

  // Protected Members
  protected:
    RenderViewThread *mThread;
    unsigned int mWidth, mHeight;
    bool mLeftPressed, mShiftPressed;
    QPoint mLastMousePos;
};

#endif // RENDERVIEW_H
